package cn.jorian.framework.repository;

import cn.jorian.framework.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface UserRepository extends JpaRepository<User, Long> {

    List<User> findByEmail(String email);

    // 使用@Query自定义JPQL查询
    @Query("SELECT u FROM User u WHERE u.age < :age")
    List<User> findByAgeLessThan(@Param("age") Integer age);
}
